package com.zj.ssm.controller;

import com.zj.ssm.pojo.domain.vo.UsernameVo;
import com.zj.ssm.result.AjaxResult;
import com.zj.ssm.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lilinhui
 * @author diao 2022/1/7 星期五 20:21
 */
@RestController
@RequestMapping("customer")
public class UserController {

    @Autowired
    private CustomerService customerService;

    @RequestMapping("login")
    public AjaxResult login(String username, String password){
        return customerService.login(username,password);
    }

    @RequestMapping("sendCode")
    public AjaxResult sendCode( String telephone){
        return customerService.sendCode(telephone);
    }

    @RequestMapping("register")
    public AjaxResult register(UsernameVo usernameVo){
        return customerService.register(usernameVo);
    }

    @RequestMapping("udpatePwd")
    public AjaxResult updateUser(String password ,String newPwd){
        return customerService.udpatePwd(password,newPwd);
    }

    @RequestMapping("updatePassword")
    public AjaxResult updatePassword(String username ,String password){
        return customerService.updatePassword(username,password);
    }

}